package com.yinhaochuan.tool;

import java.io.File;

public class FileList {
	
	private static final String  SEP = "/";
	private static StringBuffer sb = new StringBuffer("");
//	private static int CNT = 0;
	
	public static String[] getFiles(File f){
		if (f.isDirectory()) {
			File[] fs = f.listFiles();
			for (int i = 0; i < fs.length; i++) {
				getFiles(fs[i]);
//				CNT++;
//				System.out.println(CNT);
			}
		} else {
			sb.append(f.getPath()+SEP);
		}
		
		String s = sb.toString();
		String[] list = s.split(SEP);
		return list;
	}
	

	public static String[] getFiles(String t){
		File f = new File(t);
		
		if (f.isDirectory()) {
			File[] fs = f.listFiles();
			for (int i = 0; i < fs.length; i++) {
				getFiles(fs[i]);
//				CNT++;
//				System.out.println(CNT);
			}
		}
		else {
			sb.append(f.getPath()+SEP);
		}
		
		String s = sb.toString();
		String[] list = s.split(SEP);
		
		return list;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}


}
